package com.juli.school.service.enums;

import java.util.Arrays;

/**
 * @Description: 登录类型枚举常量
 * @author gaoxiang
 * @date 2017年11月17日 下午3:13:24
 */ 
public enum EnumLoginType {
	
	Wechat("Wechat","微信"),
	QQ("QQ","QQ"),
	Sina("Sina","新浪微博"),
	StuNo("StuNo","学生号"),
	Phone("Phone","手机号"),
	Email("Email","电子邮箱");
	
	public String code;
	
	public String module;

	private EnumLoginType(String code, String module) {
		this.code = code;
		this.module = module;
	}
	
	public static EnumLoginType codeOf(String code) {
		return Arrays.asList(EnumLoginType.values()).stream().filter(enumModule -> enumModule.code.equals(code)).findFirst().orElse(null);
	}
	
	public static boolean isSelf(String code) {
		if(StuNo.code.equals(code) || Phone.code.equals(code) || Email.code.equals(code)) return true;
		return false;
	}
	
}
